﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using WcfFlashRemoting.ServiceModel.Channels;

namespace WcfFlashRemoting.ServiceModel.Dispatcher
{
    class AmfDispatchOperationSelector : System.ServiceModel.Dispatcher.WebHttpDispatchOperationSelector
    {
        protected override string SelectOperation(ref System.ServiceModel.Channels.Message message, out bool uriMatched)
        {
            if (message is AmfMessage || message is AmfMultipleMessage)
            {
                uriMatched = true;
                if (message is AmfMultipleMessage)
                {
                    return "**AmfMultiple";
                }
                return (message as AmfMessage).AmfBody.Target;
            }
            else
            {
                uriMatched = true;
                return "**AmfPing";
            }
        }
    }
}
